import gradio as gr
from src.huggingface_summarize import summarize_wraper

with gr.Blocks() as demo:
    gr.Markdown("langchain demo")
    with gr.Tabs(): 
        with gr.TabItem("文档总结"):
            with gr.Row():
                with gr.Column():
                    file = gr.File(label="上传文档")
                with gr.Column():
                    dataframe = gr.DataFrame(label='文档总结列表',headers=["文档id", "文档名","文档总结"],datatype=["str", "str","str"])
            summarize_btn = gr.Button("开始")
            summarize_btn.click(summarize_wraper,inputs=[file],outputs=dataframe)        

demo.launch(server_name="127.0.0.1", server_port=8700)
